<?php
class Test_Controller extends Controller {
	//public $middlewares = ['Sign'=>'+:index,test', 'Auth'=>"-:index,test"];
	
	public function init() {
		parent::init();
	}
	
	public function indexAction() {
		$v = new Validator;
		$v->required('first_name')->lengthBetween(2, 10)->alpha();
		$v->required('last_name')->lengthBetween(2, 10)->alpha();
		$data = [
			'first_name' => 'Johnajjsjkajjskaj',
			'last_name' => 'Doe,',
		];
		
		$result = $v->check($data);
		if (true !== $result) {
			echo $result;
		} else {
			echo "OK"; 
		}
	}

	public function testAction() {
		$params = ['get' => self::$get, 'post' => self::$post];
		echo json_encode($params);
	}

	public function amqpAction() {
		$amqp = new Amqp('web_test');
		$amqp->sendMsg(date('Y-m-d H:i:s'));
		$amqp->close();
		echo date('Y-m-d H:i:s');
	}
}
